const store = {
  state: {
    num: 20,
  },
  actions: {
    add(newState: { num: number }, action: { type: string }) {
      newState.num++
    },
  },
  asyncActions: {
    asyncAdd(dispatch: Function) {
      setTimeout(() => {
        dispatch({
          type: 'add',
        })
      }, 1000)
    },
  },
  actionNames: {},
}

const actionNames = {}

for (let key in store.actions) {
  actionNames[key] = key
}

store.actionNames = actionNames

export default store
